package com.example.demo.common.base;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;
import java.util.List;

@Data
@ToString
public class PageResponse<T> extends BaseResponse  implements Serializable {
    /**
     * 总条数
     */
    private Long totalNum;
    /**
     * 总页数
     */
    private Integer totalPage;
    /**
     * 当前页
     */
    private Integer currPage;
    /**
     * 页大小
     */
    private Integer pageSize;


    public PageResponse(String code, String msg, T data) {
        super(code, msg, data);
    }

    public PageResponse() {
        super();
    }

    public static PageResponse initializationReturnRes(){
        PageResponse<Object> result = new PageResponse<>();
        result.setTotalNum(0l);
        result.setTotalPage(0);
        result.setCurrPage(0);
        result.setPageSize(0);
        result.setCode(BaseCode.SUCCESS.getCode());
        result.setMsg(BaseCode.SUCCESS.getMsg());
        return result;
    }
}
